<?php
namespace app\demo\controller;

use app\BaseController;
use app\common\business\Demo;
use think\exception\HttpException;

class Index extends BaseController
{
    public function index()
    {
        $categoryId = $this->app->request->param('category_id',0,'intval');
        if(empty($categoryId)){
            return show(config('status.error'),'参数不能为空');
        }
        $demo = new Demo();
        $result = $demo->getDemoDataByCategory($categoryId);

        return show(config('status.success'),'ok',$result);
    }

    public function hello($name = 'ThinkPHP6')
    {
        return 'hello,' . $name;
    }
    public function exce(){
//        return $abc;
         throw new HttpException(404,'找不到该方法');
    }
    public function abc(){
        dump($this->request->type);
    }
}
